<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${ctx}/css/index_work.css">
    <script src="${ctx}/bootstrap/jquery-1.9.1.min.js"></script>
</head>
<body>
<form>
    <input type="hidden" name="pageNum"><br>
    价格范围
    <input type="text" name="priceD">-<input type="text" name="priceX">
    已销售百分比
    <input type="text" name="salesD">-<input type="text" name="salesX">
    排序
    <select name="orderfield">
    <option value="id">编号</option>
    <option value="name">商品名称</option>
    <option value="price">商品价格</option>
    <option value="sales">商品百分比</option>
    </select>

    <select name="ordertype">
    <option value="asc">正序</option>
    <option value="desc">倒序</option>
    </select>
    <input type="submit" value="查询">
</form>
<table>
    <tr>
        <td>编号</td>
        <td>商品名称</td>
        <td>商品价格</td>
        <td>商品百分比</td>
    </tr>
    <c:forEach items="${list}" var="var">
        <tr>
              <td>${var.id}</td>
              <td>${var.name}</td>
            <td>￥${var.price}</td>
             <td>${var.sales}%</td>
        </tr>
    </c:forEach>
</table>
<a href="##" onclick="fenye(1)">首页</a>
<a href="##" onclick="fenye(${pageInfo.prePage})">上一页</a>
<a href="##" onclick="fenye(${pageInfo.nextPage})">下一页</a>
<a href="##" onclick="fenye(${pageInfo.pages})">尾页</a>
${pageInfo.pages}总页数
<script>
    function fenye(pageNum) {
        $('[name="pageNum"]').val(pageNum)
        $("form").submit();
    }
</script>
</body>
</html>